/**
 * department服务
 *
 * @author sxf
 * @email sxf02615@163.com
 * @date 2025/1/15
 */
package com.sxf.crm.service;

import com.sxf.crm.dto.DepartmentDTO;
import com.sxf.crm.dto.UserDTO;
import com.sxf.crm.entity.Department;
import com.sxf.crm.entity.User;

import java.util.List;
import java.util.Optional;
import java.util.Set;

public interface DepartmentService {
    List<Department> getDepartmentsByIds(List<Long> ids);
    
    Set<Long> getUserDepartmentIds(String username);
    List<Department> getAllDepartments(String name);
    List<Department> getDepartmentTree();
    Optional<Department> getDepartment(Long id);
    Department saveDepartment(Department department);
    void deleteDepartment(Long id);

    Set<User> getDepartmentAndChildrenUsers(Long departmentId);
    List<Department> getDepartmentAndChildren(Long departmentId);

    Department findById(Long departmentId);
    
    // 新增方法
    List<DepartmentDTO> getAllDepartmentsAsDTO(String name);
    List<UserDTO> getUsersByDepartmentAndChildren(Long departmentId);
    Set<Long> getAllChildDepartmentIds(Long parentId);
}
